﻿
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
namespace MetroNextTools.NData
{
    /// <summary>
    /// 根据item 数据产生相应的 Container数据
    /// </summary>
    public interface INItemContainerGenerator 
    {
        /// <summary>
        /// 根据Panel 获取 ItemContainer 的生成器
        /// </summary>
        /// <param name="panel"></param>
        /// <returns></returns>
        NItemContainerGenerator GetItemContainerGeneratorForPanel(Panel panel);
        /// <summary>
        /// 设置开始产生Container的起始位置和方向
        /// </summary>
        /// <param name="position"></param>
        /// <param name="direction"></param>
        /// <param name="allowStartAtRealizedItem"></param>
        void StartAt(NGeneratorPosition position,GeneratorDirection direction);
        /// <summary>
        /// 产生下一个ItemContainer
        /// </summary>
        /// <param name="isNewRealized">是否是新产生的</param>
        /// <returns></returns>
        DependencyObject GenertateNext(out bool isNewRealized);
        /// <summary>
        /// 准备容器的一些属性
        /// </summary>
        /// <param name="container"></param>
        void PrepareItemContainer(DependencyObject container);
        /// <summary>
        /// 移除所有
        /// </summary>
        void RemoveAll();
        /// <summary>
        /// 移除某个位置的
        /// </summary>
        /// <param name="position"></param>
        /// <param name="count"></param>
        void Remove(NGeneratorPosition position, int count);
        /// <summary>
        /// 根据索引获取位置
        /// </summary>
        /// <param name="itemIndex"></param>
        /// <returns></returns>
        NGeneratorPosition GeneratorPositionFromIndex(int itemIndex);
        /// <summary>
        /// 根据位置计算出索引
        /// </summary>
        /// <param name="position"></param>
        /// <returns></returns>
        int IndexFromGeneratorPosition(NGeneratorPosition position);
    }
}
